import {Map} from 'immutable'
import * as actionTypes from './constants'
const defaultState = Map({
  artistList: [],
  currentArea: -1,
  currentType: 1,
  currentTitle: '推荐歌手',
  currentInitial: -1,
  artistDetail: {},
  artistSongs: [],
  artistAlbums: [],
  artistMvs: [],
  artistIntro: [],
  artistDesc: '',
  artistId:0
})
export default function reducer(state = defaultState, action) {
  switch (action.type) {
    case actionTypes.CHANGE_ARTIST_LIST_ACTION:
      return state.set('artistList', action.artistList)
    case actionTypes.CHANGE_CURRENT_AREA_ACTION:
      return state.set('currentArea', action.currentArea)
    case actionTypes.CHANGE_CURRENT_TYPE_ACTION:
      return state.set('currentType', action.currentType)
    case actionTypes.CHANGE_CURRENT_TITLE_ACTION:
      return state.set('currentTitle', action.currentTitle)
    case actionTypes.CHANGE_CURRENT_INITIAL_ACITON:
      return state.set('currentInitial', action.currentInitial)
    case actionTypes.CHANGE_ARTIST_DETAIL_ACTION:
      return state.set('artistDetail', action.artistDetail)
    case actionTypes.CHANGE_ARTIST_SONGS_ACTION:
      return state.set('artistSongs', action.artistSongs)
    case actionTypes.CHANGE_ARTIST_ALBUMS_ACTION:
      return state.set('artistAlbums',action.artistAlbums)
    case actionTypes.CHANGE_ARTIST_MVS_ACTION:
      return state.set('artistMvs', action.artistMvs)
    case actionTypes.CHANGE_ARTIST_INTRO_ACTION:
      return state.set('artistIntro', action.artistIntro)
    case actionTypes.CHANGE_ARTIST_DESC_ACTION:
      return state.set('artistDesc', action.artistDesc)
    case actionTypes.CHANGE_ARTIST_ID_ACTION:
      return state.set('artistId',action.artistId)
    default:
      return state
  }
}